/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */

bool mycheck(struct TreeNode* l,struct TreeNode* r)
{
    if(l==NULL&&r==NULL)
        return true;
    if(l==NULL||r==NULL)
        return false;
    if(l->val!=r->val)
        return false;
    return mycheck(l->left,r->right)&&mycheck(l->right,r->left);
}

bool isSymmetric(struct TreeNode* root) {
    if(root==NULL)
        return true;
    return mycheck(root->left,root->right);
}
